-- @owner: opentestcase027
-- @date: 2022/6/9
-- @testpoint: ceil函数结合视图的使用

--step1:建表 expect:建表成功
drop table if exists t_ustore_ceil_0036;
create table t_ustore_ceil_0036(
col_1 decimal,
col_2 int ,
col_3 float8,
col_4 decimal(6,2)
) with (storage_type=ustore);
 
--step2:创建序列 expect:序列创建成功
drop sequence if exists seq_ustore_ceil_0036;
create sequence seq_ustore_ceil_0036 increment by 1 start with 100000;
 
--step3:循环插入1000条数据 expect:插入成功
begin
 for i in 1..1000 loop
      insert into t_ustore_ceil_0036 values(
   3.1415926+seq_ustore_ceil_0036.nextval,
   i,
   1.0e+100,
   i+445.255
   );
    end loop;
end;
/

--step4:创建视图 expect:建表成功
drop view if exists v_ustore_ceil_0036;
create view v_ustore_ceil_0036 as select ceil(col_1) t1 from t_ustore_ceil_0036 order by ceil(col_1);

--step5:使用视图查询 expect:结果100004~100013
select t1 from v_ustore_ceil_0036 order by t1 limit 10;

--step6:清理环境 expect:清理成功
drop sequence seq_ustore_ceil_0036;
drop view v_ustore_ceil_0036;
drop table t_ustore_ceil_0036;